<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>

</body>
<script>
// 对象的合并
var obj1 = {
    a:1,
    b:2
};
var obj2 = {
    c:3,
    d:4
};

var obj = {};

Object.assign(obj,obj1,obj2);

console.log(obj);

//=======================================================

//数组的合并

var arr1 = [1,2,3,4,5];
var arr2 = [1,2,3,4,5];

var arr = [];

Object.assign(arr,arr1,arr2);

console.log(arr);


</script>
</html>